#include<bits/stdc++.h>
using namespace std;
int n,q,a[8005],tmp,x,v;
int work(int x){
	int cnt=1;
	for(int i=1;i<=n;i++)
		if(a[i]<a[x]||(a[i]==a[x]&&i<x)) cnt++;
	return cnt;	
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=q;i++){
		scanf("%d",&tmp);
		if(tmp==1){
			scanf("%d%d",&x,&v);
			a[x]=v;
		}
		if(tmp==2){
			scanf("%d",&x);
			printf("%d\n",work(x));
		}
	}
	
	return 0;
}
